package com.yjd.pub.asynmsg.dao.impl;

import com.yjd.comm.asynmsg.model.TaskMsgModel;
import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import com.yjd.pub.asynmsg.dao.ITaskMsgDao;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * <b>description</b>：任务消息数据访问层 <br>
 * <b>time</b>：2015-01-26 18:47:03 <br>
 * <b>author</b>： ready likun_557@163.com
 */
@Component("taskMsgDao")
public class TaskMsgDaoImpl extends BaseDaoImpl implements ITaskMsgDao {

	private static final String SQLMAPNAMESPACE = TaskMsgModel.class.getName();
	private static final String PKNAME = "id";

	@Override
	public String getPrimaryKeyName() {
		return PKNAME;
	}

	@Override
	public String getSqlmapNamespace() {
		return SQLMAPNAMESPACE;
	}

	@SuppressWarnings("rawtypes")
	@Override
	public int deleteTaskMsg(Map paramMap, boolean write) throws Exception {
		return this.getSqlMap(write).delete(this.getStatement("deleteTaskMsg"),
				paramMap);
	}

	@Override
	public TaskMsgModel insertTaskMsg(TaskMsgModel taskMsgModel, boolean write)
			throws Exception {
		this.getSqlMap(write).insert(this.getStatement("insertTaskMsg"),
				taskMsgModel);
		return taskMsgModel;
	}

	@Override
	public int updateTaskMsg(TaskMsgModel taskMsgModel, boolean write)
			throws Exception {
		return this.getSqlMap(write).update(this.getStatement("updateTaskMsg"),
				taskMsgModel);
	}

	@Override
	public TaskMsgModel insertTaskMsgLog(TaskMsgModel taskMsgModel,
                                         boolean write) throws Exception {
		this.getSqlMap(write).insert(this.getStatement("insertTaskMsgLog"),
				taskMsgModel);
		return taskMsgModel;
	}

}
